﻿using UnityEngine;
using System.Collections;
using UniLua;

namespace TCG.FFI
{
	public static class UnityAnimationClipLib
	{
		public static string LIB_NAME = "UnityAnimationClipLib";

		public static int mf_GetFrameRate (ILuaState luaState)
		{
			AnimationClip clip = LuaTools.L_CheckUData (luaState, 1, LIB_NAME) as AnimationClip;
			luaState.PushNumber (clip.frameRate);
			return 1;
		}

		public static int mf_GetLength (ILuaState luaState)
		{
			AnimationClip clip = LuaTools.L_CheckUData (luaState, 1, LIB_NAME) as AnimationClip;
			luaState.PushNumber (clip.length);
			return 1;
		}

		public static int mf_GetWrapMode (ILuaState luaState)
		{
			AnimationClip clip = LuaTools.L_CheckUData (luaState, 1, LIB_NAME) as AnimationClip;
			luaState.PushInteger ((int)clip.wrapMode);
			return 1;
		}

		public static int mf_SetWrapMode (ILuaState luaState)
		{
			AnimationClip clip = LuaTools.L_CheckUData (luaState, 1, LIB_NAME) as AnimationClip;
			clip.wrapMode = (WrapMode) luaState.ToInteger (2);
			return 0;
		}
	}
}
